/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JProductBomEditor.java
 *
 * Created on 2010-10-22, 9:21:02
 */

package cn.ekuma.epos.productsfinishing;

import cn.ekuma.epos.datalogic.I_DataLogicSales;
import com.openbravo.bean.ProductBom;
import com.openbravo.data.basic.BasicException;
import com.openbravo.data.user.DirtyManager;
import com.openbravo.format.Formats;
import com.openbravo.pos.base.AppLocal;
import com.openbravo.pos.panels.AbstractRefProductEditor;
import java.util.Properties;

/**
 *
 * @author Administrator
 */
public class ProductBomEditor extends AbstractRefProductEditor<ProductBom>{

	public ProductBomEditor(I_DataLogicSales app, DirtyManager dirty) {
		super(app, dirty, true);
	}

    @Override
    public String getTabName() {
        return AppLocal.getIntString("label.BOM");
    }

    @Override
    public ProductBom createNew(Properties prop) {
        return new ProductBom(parentNode.getParentKey().getKey());
    }

    @Override
    public void rebuild(ProductBom obj) throws BasicException {
           obj.setUnits((Double)Formats.DOUBLE.parseValue(jUnit.getText()));
    }

    @Override
    public void updateUI(boolean editAble, int state) {
        super.updateUI(editAble, state);
        jUnit.setText(Formats.DOUBLE.formatValue(obj.getUnits()));
    }

    @Override
    public Class getEditClass() {
        return ProductBom.class;
    }


}
